library ieee;
use ieee.std_logic_1164.all;

entity shake_prv2 is --shake prevention module
	port(
		clk : in std_logic;
		btn_in : in std_logic;
		btn_out : out std_logic
	);
end shake_prv2;

architecture prv of shake_prv2 is 
signal count_10 : integer range 0 to 10;
begin
	process(clk) 
	begin
		if clk'event and clk = '1' then
			if btn_in = '1' then 
				if count_10 >= 10 then
					btn_out <= '1';
				else 
					count_10 <= count_10 + 1;
				end if;
			else
				if count_10 <= 0 then
					btn_out <= '0'; count_10 <= 0;
				else 
					count_10 <= count_10 - 1;
				end if;
			end if;
		end if;
	end process;
end prv;
